package org.boot.fast.core.api.mapper.provider.impl;

import org.boot.fast.core.api.mapper.provider.entity.AnalysisResultInfo;
import org.boot.fast.core.api.mapper.provider.process.InArrayProcess;

import java.util.Map;
import static org.boot.fast.core.api.mapper.provider.DynamicSqlProvider.convertParameterFormat;

public class DynamicDeleteProvider {
    /**
     * 构建DELETE语句
     */
    public static AnalysisResultInfo buildDeleteStatement(String originalSql, Map<String, Object> params) {
        if (params == null || params.isEmpty()) {
            return new AnalysisResultInfo(convertParameterFormat(originalSql), params);
        }
        // 处理批量删除
        AnalysisResultInfo processedSql = InArrayProcess.toInArraySql(originalSql, params);
        return new AnalysisResultInfo(convertParameterFormat(processedSql.getSql()), processedSql.getParam());
    }


}
